﻿@model eBusiness.Models.Product
@{
    ViewBag.Title = "Details";
    Layout = "../Shared/_Layout.cshtml";
}
<h2>
    Details</h2>
<fieldset>
    <legend>Product</legend>
    <table class="dashboardTable">
        <tr>
            <td style="width: 320px;padding:10px;">
                <img src="@Model.ThumbImage" alt="thumbimage" class="detailThumbImage" />
                <div id="priceDiv">
                    <div>
                        Price:
                    </div>
                    <div>
                        <span class="blueText" style="font-size: 2em; font-weight: bold">@Html.DisplayFor(model => model.Price)</span><span>
                            VND</span>
                    </div>
                    <div>
                        Original Price:
                    </div>
                    <div>
                        <span class="orangeText" style="font-size: 1.7em;">@Html.DisplayFor(model => model.OriginalPrice)</span><span>
                            VND</span>
                    </div>
                    @if (Model.IsDiscount)
                    {
                        <div>
                            Discount by Number
                        </div>
                        <div>
                            <span class="redText" style="font-size: 1.3em; font-weight: bold">@Model.DiscountByNumber
                            </span><span>VND</span>
                        </div>
                        <div>
                            Discount by Percent
                        </div>
                        <div class="redText" style="font-size: 1.3em; font-weight: bold">
                            @Model.DiscountByPercent %
                        </div>
                    }
                </div>
                <div class="productImageDiv">
                    <ul class="nav_common_ul">
                        @if (!string.IsNullOrEmpty(Model.Images))
                        {
                            foreach (var image in Model.Images.Split(':'))
                            {
                                if (!string.IsNullOrEmpty(image))
                                {
                                    <li>
                                        <img class="productImagesDetail" src="@image" alt="images" />
                                    </li>
                                }
                            }
                        }
                    </ul>
                </div>
            </td>
            <td>
                <table class="dashboardTable">
                    <tr>
                        <td colspan="3">                            
                            <h1 style="color: #5C87B2; font-weight: bold; margin-left:20px;">@Html.DisplayFor(model => model.Name)</h1>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Categories
                        </td>
                        <td>
                            @foreach (var cat in Model.Categories)
                            {
                                <a href="@Url.Action("Details", "Categories", new { id = @cat.ID })">@cat.Name</a>
                                @:,
                                                        }
                        </td>
                        <td rowspan="5" class="rightcolProductDetail">
                            <div class="redText" style="font-weight: bold; font-size:2em">
                                <span>
                                    @Model.QuantityInStock
                                </span>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Code
                        </td>
                        <td>
                            @Html.DisplayFor(model => model.Code)
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Color
                        </td>
                        <td>
                            @Html.DisplayFor(model => model.Color)
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Size
                        </td>
                        <td>
                            @Html.DisplayFor(model => model.Size)
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Type
                        </td>
                        <td>
                            @Html.DisplayFor(model => model.Type)
                        </td>
                    </tr>
                    <tr>
                        <td>
                            MadeFrom
                        </td>
                        <td>
                            @Html.DisplayFor(model => model.MadeFrom)
                        </td>
                        <td rowspan="6"  class="rightcolProductDetail">
                            <div  style="font-weight: bold; font-size:1.8em;color:#87B6EE">
                                @Model.Status.Name
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            MadeBy
                        </td>
                        <td>
                            @Html.DisplayFor(model => model.MadeBy)
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Manufacture
                        </td>
                        <td>
                            @Html.DisplayFor(model => model.Manufacture.Name)
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Warranty
                        </td>
                        <td>
                            @Html.DisplayFor(model => model.Warranty)
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <b>Configuration</b>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Hot
                        </td>
                        <td>
                            @if (@Model.IsHot && (!string.IsNullOrEmpty(@Model.IsHotStartDate.ToString()) || !string.IsNullOrEmpty(@Model.IsHotEndDate.ToString())))
                            {

                                if (!string.IsNullOrEmpty(@Model.IsHotStartDate.ToString()))
                                {
                                @:From
                                    <span>@Model.IsHotStartDate.Value.ToString("dd/MM/yyyy")</span>
                                }
                                if (!string.IsNullOrEmpty(@Model.IsHotEndDate.ToString()))
                                {
                                @:To
                                    <span>@Model.IsHotEndDate.Value.ToString("dd/MM/yyyy")</span>
                                }
                            }
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Homepage
                        </td>
                        <td>
                            @if (@Model.IsHomepage && (!string.IsNullOrEmpty(@Model.IsHomepageStartDate.ToString()) || !string.IsNullOrEmpty(@Model.IsHomepageEndDate.ToString())))
                            {

                                if (!string.IsNullOrEmpty(@Model.IsHomepageStartDate.ToString()))
                                {
                                @:From
                                    <span>@Model.IsHomepageStartDate.Value.ToString("dd/MM/yyyy")</span>
                                }
                                if (!string.IsNullOrEmpty(@Model.IsHomepageEndDate.ToString()))
                                {
                                @:To
                                    <span>@Model.IsHomepageEndDate.Value.ToString("dd/MM/yyyy")</span>
                                }
                            }
                        </td>
                        <td rowspan="7"  class="rightcolProductDetail">
                            @if (Model.IsApproved)
                            {
                                <div  class="blueText" style="font-weight: bold; font-size:1.8em;">
                                    Approved</div>
                                <div>
                                    By <i style="font-size: 1.3em; color:Aqua">
                                        @{
                                if (!string.IsNullOrEmpty(Model.CreatedBy.ToString()))
                                {
                                    var usr = Membership.GetUser(Model.ApprovedBy).UserName;
                                            @usr
                                }
                                        }
                                    </i>
                                </div>
                                <div>
                                    On <i style="font-size: 1.3em; color:Aqua">
                                        @if (!string.IsNullOrEmpty(@Model.ApprovedDate.ToString()))
                                        {
                                            @Model.ApprovedDate.Value.ToString("dd/MM/yyyy")
                                        }
                                    </i>
                                </div>
                            }
                            else
                            {
                                <div class="orangeText" style="font-weight: bold; font-size:1.8em">
                                    Not Approved
                                </div>
                            }
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Discount
                        </td>
                        <td>
                            @if (@Model.IsDiscount && (!string.IsNullOrEmpty(@Model.DiscountStartDate.ToString()) || !string.IsNullOrEmpty(@Model.DiscountEndDate.ToString())))
                            {

                                if (!string.IsNullOrEmpty(@Model.DiscountStartDate.ToString()))
                                {
                                @:From
                                    <span>@Model.DiscountStartDate.Value.ToString("dd/MM/yyyy")</span>
                                }
                                if (!string.IsNullOrEmpty(@Model.DiscountEndDate.ToString()))
                                {
                                @:To
                                    <span>@Model.DiscountEndDate.Value.ToString("dd/MM/yyyy")</span>
                                }
                            }
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <b>Other Infos</b>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Created by
                        </td>
                        <td>
                            @{
                                if (!string.IsNullOrEmpty(Model.CreatedBy.ToString()))
                                {
                                    var usr = Membership.GetUser(Model.CreatedBy).UserName;
                                @usr
                                }
                            }
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Created date
                        </td>
                        <td>
                            @if (!string.IsNullOrEmpty(@Model.CreatedDate.ToString()))
                            {
                                @Model.CreatedDate.Value.ToString("dd/MM/yyyy")
                            }
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Updated by
                        </td>
                        <td>
                            @{
                                if (!string.IsNullOrEmpty(Model.CreatedBy.ToString()))
                                {
                                    var usr = Membership.GetUser(Model.CreatedBy).UserName;
                                @usr
                                }
                            }
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Created date
                        </td>
                        <td>
                            @if (!string.IsNullOrEmpty(@Model.LastModifiedDate.ToString()))
                            {
                                @Model.LastModifiedDate.Value.ToString("dd/MM/yyyy")
                            }
                        </td>
                    </tr>
                    <tr>
                        <td colspan="3">
                            <b>Description</b>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="3">
                            @Model.Description
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
</fieldset>
<p>
    @Html.ActionLink("Edit", "Edit", new { id = Model.ID }) |
    @Html.ActionLink("Back to List", "Index")
</p>
